﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Albatross.WPF.Common.Controls {
	[TemplatePart(Name = "PART_LeftSplitter", Type = typeof(GridSplitter))]
	[TemplatePart(Name = "PART_RightSplitter", Type = typeof(GridSplitter))]
	[TemplatePart(Name = "PART_TopSplitter", Type = typeof(GridSplitter))]
	[TemplatePart(Name = "PART_BottomSplitter", Type = typeof(GridSplitter))]

	[TemplatePart(Name = "PART_LeftSection", Type = typeof(ColumnDefinition))]
	[TemplatePart(Name = "PART_RightSection", Type = typeof(ColumnDefinition))]
	[TemplatePart(Name = "PART_TopSection", Type = typeof(RowDefinition))]
	[TemplatePart(Name = "PART_BottomSection", Type = typeof(RowDefinition))]

	[TemplatePart(Name = "PART_LeftCollapsedBar", Type = typeof(ContentPresenter))]
	[TemplatePart(Name = "PART_RightCollapsedBar", Type = typeof(ContentPresenter))]
	[TemplatePart(Name = "PART_TopHeader", Type = typeof(ContentPresenter))]
	[TemplatePart(Name = "PART_BottomHeader", Type = typeof(ContentPresenter))]
	public class AlbatrossDockPanel : ContentControl {
		static AlbatrossDockPanel() {
			DefaultStyleKeyProperty.OverrideMetadata(typeof(AlbatrossDockPanel), new FrameworkPropertyMetadata(typeof(AlbatrossDockPanel)));
		}

		GridSplitter PART_LeftSplitter;
		GridSplitter PART_RightSplitter;
		GridSplitter PART_TopSplitter;
		GridSplitter PART_BottomSplitter;

		ColumnDefinition PART_LeftSection;
		ColumnDefinition PART_RightSection;
		RowDefinition PART_TopSection;
		RowDefinition PART_BottomSection;

		ContentPresenter PART_LeftCollapsedBar;
		ContentPresenter PART_RightCollapsedBar;
		ContentPresenter PART_TopHeader;
		ContentPresenter PART_BottomHeader;

		double _leftExpandedMeasure = double.NaN;
		double _rightExpandedMeasure = double.NaN;
		double _topExpandedMeasure = double.NaN;
		double _bottomExpandedMeasure = double.NaN;

		public override void OnApplyTemplate() {
			base.OnApplyTemplate();

			PART_LeftSplitter = GetTemplateChild("PART_LeftSplitter") as GridSplitter;
			PART_RightSplitter = GetTemplateChild("PART_RightSplitter") as GridSplitter;
			PART_TopSplitter = GetTemplateChild("PART_TopSplitter") as GridSplitter;
			PART_BottomSplitter = GetTemplateChild("PART_BottomSplitter") as GridSplitter;

			PART_LeftSection = GetTemplateChild("PART_LeftSection") as ColumnDefinition;
			PART_RightSection = GetTemplateChild("PART_RightSection") as ColumnDefinition;
			PART_TopSection = GetTemplateChild("PART_TopSection") as RowDefinition;
			PART_BottomSection = GetTemplateChild("PART_BottomSection") as RowDefinition;

			PART_LeftCollapsedBar = GetTemplateChild("PART_LeftCollapsedBar") as ContentPresenter;
			PART_RightCollapsedBar = GetTemplateChild("PART_RightCollapsedBar") as ContentPresenter;
			PART_TopHeader = GetTemplateChild("PART_TopHeader") as ContentPresenter;
			PART_BottomHeader = GetTemplateChild("PART_BottomHeader") as ContentPresenter;

			PART_LeftSplitter.DragStarted += PART_LeftSplitter_DragStarted;
			PART_RightSplitter.DragStarted += PART_RightSplitter_DragStarted;
			PART_TopSplitter.DragStarted += PART_TopSplitter_DragStarted;
			PART_BottomSplitter.DragStarted += PART_BottomSplitter_DragStarted;
			
			PART_LeftSplitter.DragCompleted += PART_LeftSplitter_DragCompleted;
			PART_RightSplitter.DragCompleted += PART_RightSplitter_DragCompleted;
			PART_TopSplitter.DragCompleted += PART_TopSplitter_DragCompleted;
			PART_BottomSplitter.DragCompleted += PART_BottomSplitter_DragCompleted;


			PART_LeftSplitter.MouseDoubleClick += GridSplitter_MouseDoubleClick;
			PART_RightSplitter.MouseDoubleClick += GridSplitter_MouseDoubleClick;
			PART_TopSplitter.MouseDoubleClick += GridSplitter_MouseDoubleClick;
			PART_BottomSplitter.MouseDoubleClick += GridSplitter_MouseDoubleClick;
		}

		[Category("Behavior")]
		public event DragStartedEventHandler LeftDragStarted;
		[Category("Behavior")]
		public event DragStartedEventHandler RightDragStarted;
		[Category("Behavior")]
		public event DragStartedEventHandler TopDragStarted;
		[Category("Behavior")]
		public event DragStartedEventHandler BottomDragStarted;
		[Category("Behavior")]
		public event DragCompletedEventHandler LeftDragCompleted;
		[Category("Behavior")]
		public event DragCompletedEventHandler RightDragCompleted;
		[Category("Behavior")]
		public event DragCompletedEventHandler TopDragCompleted;
		[Category("Behavior")]
		public event DragCompletedEventHandler BottomDragCompleted;


		void PART_BottomSplitter_DragStarted(object sender, DragStartedEventArgs e) {
			var handle = BottomDragStarted;
			if (handle != null) handle(sender, e);
		}

		void PART_TopSplitter_DragStarted(object sender, DragStartedEventArgs e) {
			var handle = TopDragStarted;
			if (handle != null) handle(sender, e);
		}

		void PART_RightSplitter_DragStarted(object sender, DragStartedEventArgs e) {
			var handle = RightDragStarted;
			if (handle != null) handle(sender, e);
		}

		void PART_LeftSplitter_DragStarted(object sender, DragStartedEventArgs e) {
			var handle = LeftDragStarted;
			if (handle != null) handle(sender, e);
		}

		void GridSplitter_MouseDoubleClick(object sender, MouseButtonEventArgs e) {
			if (sender == PART_LeftSplitter) {
				IsLeftExpanded = true;
				LeftSectionWidth = double.NaN;
				PART_LeftSection.Width = GridLength.Auto;
			} else if (sender == PART_RightSplitter) {
				IsRightExpanded = true;
				RightSectionWidth = double.NaN;
				PART_RightSection.Width = GridLength.Auto;
			} else if (sender == PART_TopSplitter) {
				IsTopExpanded = true;
				TopSectionHeight = double.NaN;
				PART_TopSection.Height = GridLength.Auto;
			} else if (sender == PART_BottomSplitter) {
				IsBottomExpanded = true;
				BottomSectionHeight = double.NaN;
				PART_BottomSection.Height = GridLength.Auto;
			}
		}

		void PART_LeftSplitter_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) {
			if (e.HorizontalChange != 0) {
				if (PART_LeftSection.Width.Value > PART_LeftCollapsedBar.ActualWidth) {
					IsLeftExpanded = true;
					LeftSectionWidth = PART_LeftSection.Width.Value;
				} else {
					IsLeftExpanded = false;
					LeftSectionWidth = double.NaN;
					PART_LeftSection.Width = GridLength.Auto;
				}
			}
			var handle = LeftDragCompleted;
			if (handle != null) handle(sender, e);
		}

		void PART_RightSplitter_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) {
			if (e.HorizontalChange != 0) {
				if (PART_RightSection.Width.Value > PART_RightCollapsedBar.ActualWidth) {
					IsRightExpanded = true;
					RightSectionWidth = PART_RightSection.Width.Value;
				} else {
					IsRightExpanded = false;
					RightSectionWidth = double.NaN;
					PART_RightSection.Width = GridLength.Auto;
				}
			}
			var handle = RightDragCompleted;
			if (handle != null) handle(sender, e);
		}

		void PART_TopSplitter_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) {
			if (e.VerticalChange != 0) {
				if (PART_TopSection.Height.Value > PART_TopHeader.ActualHeight) {
					IsTopExpanded = true;
					TopSectionHeight = PART_TopSection.Height.Value;
				} else {
					IsTopExpanded = false;
					TopSectionHeight = double.NaN;
					PART_TopSection.Height = GridLength.Auto;
				}
			}
			var handle = TopDragCompleted;
			if (handle != null) handle(sender, e);
		}

		void PART_BottomSplitter_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) {
			if (e.VerticalChange != 0) {
				if (PART_BottomSection.Height.Value > PART_BottomHeader.ActualHeight) {
					IsBottomExpanded = true;
					BottomSectionHeight = PART_BottomSection.Height.Value;
				} else {
					IsBottomExpanded = false;
					BottomSectionHeight = double.NaN;
					PART_BottomSection.Height = GridLength.Auto;
				}
			}
			var handle = BottomDragCompleted;
			if (handle != null) handle(sender, e);
		}

		#region dependency properties
		
		public const string LeftHeaderTemplatePropertyName = "LeftHeaderTemplate";
		public static readonly DependencyProperty LeftHeaderTemplateProperty = DependencyProperty.Register(LeftHeaderTemplatePropertyName, typeof(DataTemplate), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public DataTemplate LeftHeaderTemplate {
			get { return (DataTemplate)GetValue(LeftHeaderTemplateProperty); }
			set { SetValue(LeftHeaderTemplateProperty, value); }
		}
		
		public const string RightHeaderTemplatePropertyName = "RightHeaderTemplate";
		public static readonly DependencyProperty RightHeaderTemplateProperty = DependencyProperty.Register(RightHeaderTemplatePropertyName, typeof(DataTemplate), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public DataTemplate RightHeaderTemplate {
			get { return (DataTemplate)GetValue(RightHeaderTemplateProperty); }
			set { SetValue(RightHeaderTemplateProperty, value); }
		}
		
		public const string TopHeaderTemplatePropertyName = "TopHeaderTemplate";
		public static readonly DependencyProperty TopHeaderTemplateProperty = DependencyProperty.Register(TopHeaderTemplatePropertyName, typeof(DataTemplate), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public DataTemplate TopHeaderTemplate {
			get { return (DataTemplate)GetValue(TopHeaderTemplateProperty); }
			set { SetValue(TopHeaderTemplateProperty, value); }
		}
		
		public const string BottomHeaderTemplatePropertyName = "BottomHeaderTemplate";
		public static readonly DependencyProperty BottomHeaderTemplateProperty = DependencyProperty.Register(BottomHeaderTemplatePropertyName, typeof(DataTemplate), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public DataTemplate BottomHeaderTemplate {
			get { return (DataTemplate)GetValue(BottomHeaderTemplateProperty); }
			set { SetValue(BottomHeaderTemplateProperty, value); }
		}
		
		public const string LeftCollapseBarTemplatePropertyName = "LeftCollapseBarTemplate";
		public static readonly DependencyProperty LeftCollapseBarTemplateProperty = DependencyProperty.Register(LeftCollapseBarTemplatePropertyName, typeof(DataTemplate), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public DataTemplate LeftCollapseBarTemplate {
			get { return (DataTemplate)GetValue(LeftCollapseBarTemplateProperty); }
			set { SetValue(LeftCollapseBarTemplateProperty, value); }
		}
		
		public const string RightCollapseBarTemplatePropertyName = "RightCollapseBarTemplate";
		public static readonly DependencyProperty RightCollapseBarTemplateProperty = DependencyProperty.Register(RightCollapseBarTemplatePropertyName, typeof(DataTemplate), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public DataTemplate RightCollapseBarTemplate {
			get { return (DataTemplate)GetValue(RightCollapseBarTemplateProperty); }
			set { SetValue(RightCollapseBarTemplateProperty, value); }
		}
	
		public const string LeftSectionWidthPropertyName = "LeftSectionWidth";
		public static readonly DependencyProperty LeftSectionWidthProperty = DependencyProperty.Register(LeftSectionWidthPropertyName, typeof(double), typeof(AlbatrossDockPanel), new UIPropertyMetadata(double.NaN));
		public double LeftSectionWidth {
			get { return (double)GetValue(LeftSectionWidthProperty); }
			set { SetValue(LeftSectionWidthProperty, value); }
		}

		public const string RightSectionWidthPropertyName = "RightSectionWidth";
		public static readonly DependencyProperty RightSectionWidthProperty = DependencyProperty.Register(RightSectionWidthPropertyName, typeof(double), typeof(AlbatrossDockPanel), new UIPropertyMetadata(double.NaN));
		public double RightSectionWidth {
			get { return (double)GetValue(RightSectionWidthProperty); }
			set { SetValue(RightSectionWidthProperty, value); }
		}

		public const string TopSectionHeightPropertyName = "TopSectionHeight";
		public static readonly DependencyProperty TopSectionHeightProperty = DependencyProperty.Register(TopSectionHeightPropertyName, typeof(double), typeof(AlbatrossDockPanel), new UIPropertyMetadata(double.NaN));
		public double TopSectionHeight {
			get { return (double)GetValue(TopSectionHeightProperty); }
			set { SetValue(TopSectionHeightProperty, value); }
		}

		public const string BottomSectionHeightPropertyName = "BottomSectionHeight";
		public static readonly DependencyProperty BottomSectionHeightProperty = DependencyProperty.Register(BottomSectionHeightPropertyName, typeof(double), typeof(AlbatrossDockPanel), new UIPropertyMetadata(double.NaN));
		public double BottomSectionHeight {
			get { return (double)GetValue(BottomSectionHeightProperty); }
			set { SetValue(BottomSectionHeightProperty, value); }
		}

		public const string DockLeftPropertyName = "DockLeft";
		public static readonly DependencyProperty DockLeftProperty = DependencyProperty.Register(DockLeftPropertyName, typeof(bool), typeof(AlbatrossDockPanel), new PropertyMetadata());
		public bool DockLeft {
			get { return (bool)GetValue(DockLeftProperty); }
			set { SetValue(DockLeftProperty, value); }
		}
		public const string DockRightPropertyName = "DockRight";
		public static readonly DependencyProperty DockRightProperty = DependencyProperty.Register(DockRightPropertyName, typeof(bool), typeof(AlbatrossDockPanel), new PropertyMetadata());
		public bool DockRight {
			get { return (bool)GetValue(DockRightProperty); }
			set { SetValue(DockRightProperty, value); }
		}
		public const string DockTopPropertyName = "DockTop";
		public static readonly DependencyProperty DockTopProperty = DependencyProperty.Register(DockTopPropertyName, typeof(bool), typeof(AlbatrossDockPanel), new PropertyMetadata());
		public bool DockTop {
			get { return (bool)GetValue(DockTopProperty); }
			set { SetValue(DockTopProperty, value); }
		}
		public const string DockBottomPropertyName = "DockBottom";
		public static readonly DependencyProperty DockBottomProperty = DependencyProperty.Register(DockBottomPropertyName, typeof(bool), typeof(AlbatrossDockPanel), new PropertyMetadata());
		public bool DockBottom {
			get { return (bool)GetValue(DockBottomProperty); }
			set { SetValue(DockBottomProperty, value); }
		}


		public const string IsLeftExpandedPropertyName = "IsLeftExpanded";
		public static readonly DependencyProperty IsLeftExpandedProperty = DependencyProperty.Register(IsLeftExpandedPropertyName, typeof(bool), typeof(AlbatrossDockPanel), new UIPropertyMetadata(false, IsLeftExpandedPropertyChangedCallback));
		public bool IsLeftExpanded {
			get { return (bool)GetValue(IsLeftExpandedProperty); }
			set { SetValue(IsLeftExpandedProperty, value); }
		}
		static void IsLeftExpandedPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) {
			AlbatrossDockPanel panel = (AlbatrossDockPanel)d;
			if ((bool)e.NewValue) {
				panel.LeftSectionWidth = panel._leftExpandedMeasure;
			} else {
				panel._leftExpandedMeasure = panel.LeftSectionWidth;
				panel.LeftSectionWidth = double.NaN;
				panel.PART_LeftSection.Width = GridLength.Auto;
			}
		}

		public const string IsRightExpandedPropertyName = "IsRightExpanded";
		public static readonly DependencyProperty IsRightExpandedProperty = DependencyProperty.Register(IsRightExpandedPropertyName, typeof(bool), typeof(AlbatrossDockPanel), new UIPropertyMetadata(false, IsRightExpandedPropertyChangedCallback));
		public bool IsRightExpanded {
			get { return (bool)GetValue(IsRightExpandedProperty); }
			set { SetValue(IsRightExpandedProperty, value); }
		}
		static void IsRightExpandedPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) {
			AlbatrossDockPanel panel = (AlbatrossDockPanel)d;
			if ((bool)e.NewValue) {
				panel.RightSectionWidth = panel._rightExpandedMeasure;
			} else {
				panel._rightExpandedMeasure = panel.RightSectionWidth;
				panel.RightSectionWidth = double.NaN;
				panel.PART_RightSection.Width = GridLength.Auto;
			}
		}

		public const string IsTopExpandedPropertyName = "IsTopExpanded";
		public static readonly DependencyProperty IsTopExpandedProperty = DependencyProperty.Register(IsTopExpandedPropertyName, typeof(bool), typeof(AlbatrossDockPanel), new UIPropertyMetadata(false, IsTopExpandedPropertyChangedCallback));
		public bool IsTopExpanded {
			get { return (bool)GetValue(IsTopExpandedProperty); }
			set { SetValue(IsTopExpandedProperty, value); }
		}
		static void IsTopExpandedPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) {
			AlbatrossDockPanel panel = (AlbatrossDockPanel)d;
			if ((bool)e.NewValue) {
				panel.TopSectionHeight = panel._topExpandedMeasure;
			} else {
				panel._topExpandedMeasure = panel.TopSectionHeight;
				panel.TopSectionHeight = double.NaN;
				panel.PART_TopSection.Height = GridLength.Auto;
			}
		}

		public const string IsBottomExpandedPropertyName = "IsBottomExpanded";
		public static readonly DependencyProperty IsBottomExpandedProperty = DependencyProperty.Register(IsBottomExpandedPropertyName, typeof(bool), typeof(AlbatrossDockPanel), new UIPropertyMetadata(false, IsBottomExpandedPropertyChangedCallback));
		public bool IsBottomExpanded {
			get { return (bool)GetValue(IsBottomExpandedProperty); }
			set { SetValue(IsBottomExpandedProperty, value); }
		}
		static void IsBottomExpandedPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) {
			AlbatrossDockPanel panel = (AlbatrossDockPanel)d;
			if ((bool)e.NewValue) {
				panel.BottomSectionHeight = panel._bottomExpandedMeasure;
			} else {
				panel._bottomExpandedMeasure = panel.BottomSectionHeight;
				panel.BottomSectionHeight = double.NaN;
				panel.PART_BottomSection.Height = GridLength.Auto;
			}
		}


		public const string TopPropertyName = "Top";
		public static readonly DependencyProperty TopProperty = DependencyProperty.Register(TopPropertyName, typeof(object), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public object Top {
			get { return (object)GetValue(TopProperty); }
			set { SetValue(TopProperty, value); }
		}
		public const string BottomPropertyName = "Bottom";
		public static readonly DependencyProperty BottomProperty = DependencyProperty.Register(BottomPropertyName, typeof(object), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public object Bottom {
			get { return (object)GetValue(BottomProperty); }
			set { SetValue(BottomProperty, value); }
		}
		public const string LeftPropertyName = "Left";
		public static readonly DependencyProperty LeftProperty = DependencyProperty.Register(LeftPropertyName, typeof(object), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public object Left {
			get { return (object)GetValue(LeftProperty); }
			set { SetValue(LeftProperty, value); }
		}
		public const string RightPropertyName = "Right";
		public static readonly DependencyProperty RightProperty = DependencyProperty.Register(RightPropertyName, typeof(object), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public object Right {
			get { return (object)GetValue(RightProperty); }
			set { SetValue(RightProperty, value); }
		}


		public const string LeftHeaderPropertyName = "LeftHeader";
		public static readonly DependencyProperty LeftHeaderProperty = DependencyProperty.Register(LeftHeaderPropertyName, typeof(string), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public string LeftHeader {
			get { return (string)GetValue(LeftHeaderProperty); }
			set { SetValue(LeftHeaderProperty, value); }
		}
		public const string RightHeaderPropertyName = "RightHeader";
		public static readonly DependencyProperty RightHeaderProperty = DependencyProperty.Register(RightHeaderPropertyName, typeof(string), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public string RightHeader {
			get { return (string)GetValue(RightHeaderProperty); }
			set { SetValue(RightHeaderProperty, value); }
		}
		public const string TopHeaderPropertyName = "TopHeader";
		public static readonly DependencyProperty TopHeaderProperty = DependencyProperty.Register(TopHeaderPropertyName, typeof(string), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public string TopHeader {
			get { return (string)GetValue(TopHeaderProperty); }
			set { SetValue(TopHeaderProperty, value); }
		}
		public const string BottomHeaderPropertyName = "BottomHeader";
		public static readonly DependencyProperty BottomHeaderProperty = DependencyProperty.Register(BottomHeaderPropertyName, typeof(string), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public string BottomHeader {
			get { return (string)GetValue(BottomHeaderProperty); }
			set { SetValue(BottomHeaderProperty, value); }
		}

		public const string LeftHeaderBackgroundPropertyName = "LeftHeaderBackground";
		public static readonly DependencyProperty LeftHeaderBackgroundProperty = DependencyProperty.Register(LeftHeaderBackgroundPropertyName, typeof(Brush), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Brush LeftHeaderBackground {
			get { return (Brush)GetValue(LeftHeaderBackgroundProperty); }
			set { SetValue(LeftHeaderBackgroundProperty, value); }
		}
		public const string RightHeaderBackgroundPropertyName = "RightHeaderBackground";
		public static readonly DependencyProperty RightHeaderBackgroundProperty = DependencyProperty.Register(RightHeaderBackgroundPropertyName, typeof(Brush), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Brush RightHeaderBackground {
			get { return (Brush)GetValue(RightHeaderBackgroundProperty); }
			set { SetValue(RightHeaderBackgroundProperty, value); }
		}
		public const string TopHeaderBackgroundPropertyName = "TopHeaderBackground";
		public static readonly DependencyProperty TopHeaderBackgroundProperty = DependencyProperty.Register(TopHeaderBackgroundPropertyName, typeof(Brush), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Brush TopHeaderBackground {
			get { return (Brush)GetValue(TopHeaderBackgroundProperty); }
			set { SetValue(TopHeaderBackgroundProperty, value); }
		}
		public const string BottomHeaderBackgroundPropertyName = "BottomHeaderBackground";
		public static readonly DependencyProperty BottomHeaderBackgroundProperty = DependencyProperty.Register(BottomHeaderBackgroundPropertyName, typeof(Brush), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Brush BottomHeaderBackground {
			get { return (Brush)GetValue(BottomHeaderBackgroundProperty); }
			set { SetValue(BottomHeaderBackgroundProperty, value); }
		}


		public const string LeftHeaderMarginPropertyName = "LeftHeaderMargin";
		public static readonly DependencyProperty LeftHeaderMarginProperty = DependencyProperty.Register(LeftHeaderMarginPropertyName, typeof(Thickness), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Thickness LeftHeaderMargin {
			get { return (Thickness)GetValue(LeftHeaderMarginProperty); }
			set { SetValue(LeftHeaderMarginProperty, value); }
		}
		public const string RightHeaderMarginPropertyName = "RightHeaderMargin";
		public static readonly DependencyProperty RightHeaderMarginProperty = DependencyProperty.Register(RightHeaderMarginPropertyName, typeof(Thickness), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Thickness RightHeaderMargin {
			get { return (Thickness)GetValue(RightHeaderMarginProperty); }
			set { SetValue(RightHeaderMarginProperty, value); }
		}
		public const string TopHeaderMarginPropertyName = "TopHeaderMargin";
		public static readonly DependencyProperty TopHeaderMarginProperty = DependencyProperty.Register(TopHeaderMarginPropertyName, typeof(Thickness), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Thickness TopHeaderMargin {
			get { return (Thickness)GetValue(TopHeaderMarginProperty); }
			set { SetValue(TopHeaderMarginProperty, value); }
		}
		public const string BottomHeaderMarginPropertyName = "BottomHeaderMargin";
		public static readonly DependencyProperty BottomHeaderMarginProperty = DependencyProperty.Register(BottomHeaderMarginPropertyName, typeof(Thickness), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Thickness BottomHeaderMargin {
			get { return (Thickness)GetValue(BottomHeaderMarginProperty); }
			set { SetValue(BottomHeaderMarginProperty, value); }
		}

		public const string LeftHeaderPaddingPropertyName = "LeftHeaderPadding";
		public static readonly DependencyProperty LeftHeaderPaddingProperty = DependencyProperty.Register(LeftHeaderPaddingPropertyName, typeof(Thickness), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Thickness LeftHeaderPadding {
			get { return (Thickness)GetValue(LeftHeaderPaddingProperty); }
			set { SetValue(LeftHeaderPaddingProperty, value); }
		}
		public const string RightHeaderPaddingPropertyName = "RightHeaderPadding";
		public static readonly DependencyProperty RightHeaderPaddingProperty = DependencyProperty.Register(RightHeaderPaddingPropertyName, typeof(Thickness), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Thickness RightHeaderPadding {
			get { return (Thickness)GetValue(RightHeaderPaddingProperty); }
			set { SetValue(RightHeaderPaddingProperty, value); }
		}
		public const string TopHeaderPaddingPropertyName = "TopHeaderPadding";
		public static readonly DependencyProperty TopHeaderPaddingProperty = DependencyProperty.Register(TopHeaderPaddingPropertyName, typeof(Thickness), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Thickness TopHeaderPadding {
			get { return (Thickness)GetValue(TopHeaderPaddingProperty); }
			set { SetValue(TopHeaderPaddingProperty, value); }
		}
		public const string BottomHeaderPaddingPropertyName = "BottomHeaderPadding";
		public static readonly DependencyProperty BottomHeaderPaddingProperty = DependencyProperty.Register(BottomHeaderPaddingPropertyName, typeof(Thickness), typeof(AlbatrossDockPanel), new UIPropertyMetadata());
		public Thickness BottomHeaderPadding {
			get { return (Thickness)GetValue(BottomHeaderPaddingProperty); }
			set { SetValue(BottomHeaderPaddingProperty, value); }
		}
		#endregion
	}
}
